import { ObservableStore } from '@shared/classes/ObservableStoreClass'
import { PostRiskScheme } from '@shared/interfaces/post-risk-control'
import { Injectable } from '@angular/core'
import { deepCopy } from '@delon/util'

@Injectable()
export class PostRiskStoreService extends ObservableStore<PostRiskScheme> {
  constructor() {
    super(new PostRiskScheme())
  }

  updateValue(riskControlScheme: PostRiskScheme): void {
    const value = deepCopy(this.value)
    Object.assign(value, riskControlScheme)
    this.setValue(value)
  }

  reset(): void {
    this.setValue(new PostRiskScheme())
  }
}
